<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>objectClone</Title>
			<Shortcut>objectClone</Shortcut>
			<Description>Code snippet for Object Clone method</Description>
			<Author>DIWU</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
                                
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[        private static T Clone<T>(T source)
        {
            if (!typeof(T).IsSerializable)
            {
                throw new ArgumentException(PacomResMan.GetString("GpipSettings_NoSerializable"), PacomResMan.GetString("GpipSettings_Source"));
            }

            if (Object.ReferenceEquals(source, null))
            {
                return default(T);
            }

            IFormatter formatter = new BinaryFormatter();
            Stream stream = new MemoryStream();
            using (stream)
            {
                formatter.Serialize(stream, source);
                stream.Seek(0, SeekOrigin.Begin);
                return (T)formatter.Deserialize(stream);
            }
        }]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>